#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTreeWidget>
#include <QModelIndex>
#include "mysqldb.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void addTab_clicked();
    void tabCloseRequested(int index);

    void on_actionQuery_triggered();

    void on_actionNewConn_triggered();

    void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);

    void on_actionRun_triggered();

private:
    void connectDatabase(QTreeWidgetItem *item);
    void openDatabase(QTreeWidgetItem *item, const QString &dbName);
    void openTable(QTreeWidgetItem *item);

private:
    Ui::MainWindow *ui;

    QVector<DatabaseInfo> m_dbInfoList;
    QString m_currentDB;
};

#endif // MAINWINDOW_H
